<?php


define('TB_ARGS',DB_PREF.'news_args');

class newsDao extends vDao {
    
   
    function addArg($arg, $parent=null, $description = null, $img_url=null) {

        $sql = "INSERT INTO ".TB_ARGS." (argument, parent, description, img_url) VALUES (:argument, :parent, :description, :img_url)";
        $data = array (
                ':argument' => $arg,
                ':parent'  => $parent,
                ':description'  => $description,
                ':img_url' => $img_url
        );
        
        return $this->pdio->parametricQuery($sql, $data);
    }    
    
    function Args() {
    	$sql = "SELECT * FROM ".TB_ARGS." ORDER BY parent, argument";
    	
    	return $this->pdio->query($sql);
    }
    
    function Args_children_of($aid) {
    	$sql = "SELECT * FROM ".TB_ARGS." ORDER BY parent, argument";
    	 
    	$args = $this->pdio->query($sql);
    }    
    
}


/*
 * 
 * 
     function isInstalled($modname) {
        $sql = "select name from ".DB_PREF."modules where name=:modname";
        $data = array(':modname' => $modname);
		
		$res = $this->pdio->parametricQuery($sql, $data);

		
		if (count($res) == 0) {
		    return false;
		}
		
		return true;
        
    }
    
    function install($modname) {
        $sql = "INSERT INTO ".DB_PREF."modules (`name`, `order`) VALUES ('$modname', '0')";
        if ($this->pdio->query($sql)) {
            return true;
        }
        return false;
    }
 */